﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Blam_Unity.Classes.Engine.Halo_AA.gameAssetLevel.maps.info
{
    /// <summary>
    /// ***Language Support Strings***
    /// - English
    /// - Japanese
    /// - German
    /// - French
    /// - Spanish
    /// - LatinAmericaSpanish
    /// - Italian
    /// - Korean
    /// - Chinese
    /// - Portuguese
    /// </summary>
    static class readMapInfoData
    {
        /// <summary>
        /// Return Internal Engine Map Name
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <returns></returns>
        public static string readInternalEngineMapName(MojosIO mio)
        {
            mio.Position = 0xF44;
            return mio.ReadString(0xCE, Encoding.ASCII);
        }

        /// <summary>
        /// Return Physical Asset File Map Name
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <returns></returns>
        public static string readPhysicalAssetMapName(MojosIO mio)
        {
            mio.Position = 0x1044;
            return mio.ReadString(0xCE, Encoding.ASCII);
        }

        /// <summary>
        /// Return the engine that runs the couples map (ff, sp, mp)
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <returns></returns>
        public static string readGetMapEngineType(MojosIO mio)
        {
            mio.Position = 0x12E1;

            if (mio.ReadString(0x01, Encoding.ASCII) == "") { return "mp"; }
            else
            {
                mio.Position = 0x125C;
                if (mio.ReadString(0x01, Encoding.Unicode) == "") { return "ff"; }
                else { return "sp"; }
            }
        }

        /// <summary>
        /// Return All language names for the map
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <returns></returns>
        public static string[] readUniLanMapName(MojosIO mio)
        {
            string[] mapNames = new string[11];

            //Get English (UK) map name
            mio.Position = 0x45;
            mapNames[0] = mio.ReadString(64, Encoding.Unicode);

            //Get Japanese map name
            mio.Position = 0x85;
            mapNames[1] = mio.ReadString(64, Encoding.Unicode);

            //Get German map name
            mio.Position = 0xC5;
            mapNames[2] = mio.ReadString(64, Encoding.Unicode);

            //Get French map name
            mio.Position = 0x105;
            mapNames[3] = mio.ReadString(64, Encoding.Unicode);

            //Get Spanish map name
            mio.Position = 0x145;
            mapNames[4] = mio.ReadString(64, Encoding.Unicode);

            //Get Latin American Spanish map name
            mio.Position = 0x185;
            mapNames[5] = mio.ReadString(64, Encoding.Unicode);

            //Get Italian map name
            mio.Position = 0x1C5;
            mapNames[6] = mio.ReadString(64, Encoding.Unicode);

            //Get Korean map name
            mio.Position = 0x205;
            mapNames[7] = mio.ReadString(64, Encoding.Unicode);

            //Get Chinese map name
            mio.Position = 0x245;
            mapNames[8] = mio.ReadString(64, Encoding.Unicode);

            //Get Portuguese map name
            mio.Position = 0x2C5;
            mapNames[9] = mio.ReadString(64, Encoding.Unicode);

            return mapNames;
        }

        /// <summary>
        /// Return All language descriptions for the map
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <returns></returns>
        public static string[] readuniLanMapDesc(MojosIO mio)
        {
            string[] mapDesc = new string[11];

            //Get English (UK) map name
            mio.Position = 0x345;
            mapDesc[0] = mio.ReadString(256, Encoding.Unicode);

            //Get Japanese map name
            mio.Position = 0x445;
            mapDesc[1] = mio.ReadString(256, Encoding.Unicode);

            //Get German map name
            mio.Position = 0x545;
            mapDesc[2] = mio.ReadString(256, Encoding.Unicode);

            //Get French map name
            mio.Position = 0x645;
            mapDesc[3] = mio.ReadString(256, Encoding.Unicode);

            //Get Spanish map name
            mio.Position = 0x745;
            mapDesc[4] = mio.ReadString(256, Encoding.Unicode);

            //Get Latin American Spanish map name
            mio.Position = 0x845;
            mapDesc[5] = mio.ReadString(256, Encoding.Unicode);

            //Get Italian map name
            mio.Position = 0x945;
            mapDesc[6] = mio.ReadString(256, Encoding.Unicode);

            //Get Korean map name
            mio.Position = 0xA45;
            mapDesc[7] = mio.ReadString(256, Encoding.Unicode);

            //Get Chinese map name
            mio.Position = 0xB45;
            mapDesc[8] = mio.ReadString(256, Encoding.Unicode);

            //Get Portuguese map name
            mio.Position = 0xD45;
            mapDesc[9] = mio.ReadString(256, Encoding.Unicode);

            return mapDesc;
        }

        /// <summary>
        /// Return All rallypoints and engine calls in every language
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <returns></returns>
        public static string[] readMissionRallyPoints(MojosIO mio)
        {
            string[] rallyPoints = new string[35];

            bool rally2 = false;
            bool rally3 = false;

            int rally2Off = 0;
            int rally3Off = 0;

            #region rally1
            //Mission Start - Omega
            mio.Position = 0x125C;
            rallyPoints[1] = mio.ReadString(0x85, Encoding.ASCII);

            ///English
            mio.Position = 0x12E1;
            rallyPoints[2] = mio.ReadString(0x3E, Encoding.Unicode);

            ///Japanese
            mio.Position = 0x1320;
            rallyPoints[3] = mio.ReadString(0x3E, Encoding.Unicode);

            ///German
            mio.Position = 0x1361;
            rallyPoints[4] = mio.ReadString(0x3E, Encoding.Unicode);

            ///French
            mio.Position = 0x13A1;
            rallyPoints[5] = mio.ReadString(0x3E, Encoding.Unicode);

            ///Spanish
            mio.Position = 0x13E1;
            rallyPoints[6] = mio.ReadString(0x3E, Encoding.Unicode);

            ///Latin American Spanish
            mio.Position = 0x1421;
            rallyPoints[7] = mio.ReadString(0x3E, Encoding.Unicode);

            ///Italian
            mio.Position = 0x1461;
            rallyPoints[8] = mio.ReadString(0x3E, Encoding.Unicode);

            ///Korean
            mio.Position = 0x14A0;
            rallyPoints[9] = mio.ReadString(0x3E, Encoding.Unicode);

            ///Chinese
            mio.Position = 0x14E0;
            rallyPoints[10] = mio.ReadString(0x3E, Encoding.Unicode);

            ///Portuguese
            mio.Position = 0x1561;
            rallyPoints[11] = mio.ReadString(0x3E, Encoding.Unicode);
            #endregion

            #region checkForRally2&3
            for (int i = 0; i < Convert.ToInt32(mio.StreamLength); i++)
            {
                mio.Position = i;
                if (mio.ReadString(0x3E, Encoding.Unicode) == "Rally Point Alpha")
                {
                    rally2 = true;
                    rally2Off = i;
                }

                mio.Position = i;
                if (mio.ReadString(0x3E, Encoding.Unicode) == "Rally Point Bravo")
                {
                    rally3 = true;
                    rally3Off = i;
                }
            }
            #endregion

            #region rally2
            if (rally2 == true)
            {
                //Rally Point Alpha
                mio.Position = (rally2Off - 133);
                rallyPoints[12] = mio.ReadString(0x85, Encoding.ASCII);

                ///English
                mio.Position = rally2Off;
                rallyPoints[13] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Japanese
                mio.Position = rally2Off + 0x3F;
                rallyPoints[14] = mio.ReadString(0x3E, Encoding.Unicode);

                ///German
                mio.Position = rally2Off + 0x80;
                rallyPoints[15] = mio.ReadString(0x3E, Encoding.Unicode);

                ///French
                mio.Position = rally2Off + 0xC0;
                rallyPoints[16] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Spanish
                mio.Position = rally2Off + 0x100;
                rallyPoints[17] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Latin American Spanish
                mio.Position = rally2Off + 0x140;
                rallyPoints[18] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Italian
                mio.Position = rally2Off + 0x180;
                rallyPoints[19] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Korean
                mio.Position = rally2Off + 0x1BF;
                rallyPoints[20] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Chinese
                mio.Position = rally2Off + 0x1FF;
                rallyPoints[21] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Portuguese
                mio.Position = rally2Off + 0x280;
                rallyPoints[22] = mio.ReadString(0x3E, Encoding.Unicode);
            }
            #endregion

            #region rally3
            if (rally3 == true)
            {
                //Rally Point Bravo
                mio.Position = (rally3Off - 133);
                rallyPoints[23] = mio.ReadString(0x85, Encoding.ASCII);

                ///English
                mio.Position = rally3Off;
                rallyPoints[24] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Japanese
                mio.Position = rally3Off + 0x3F;
                rallyPoints[25] = mio.ReadString(0x3E, Encoding.Unicode);

                ///German
                mio.Position = rally3Off + 0x80;
                rallyPoints[26] = mio.ReadString(0x3E, Encoding.Unicode);

                ///French
                mio.Position = rally3Off + 0xC0;
                rallyPoints[27] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Spanish
                mio.Position = rally3Off + 0x100;
                rallyPoints[28] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Latin American Spanish
                mio.Position = rally3Off + 0x140;
                rallyPoints[29] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Italian
                mio.Position = rally3Off + 0x180;
                rallyPoints[30] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Korean
                mio.Position = rally3Off + 0x1BF;
                rallyPoints[31] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Chinese
                mio.Position = rally3Off + 0x1FF;
                rallyPoints[32] = mio.ReadString(0x3E, Encoding.Unicode);

                ///Portuguese
                mio.Position = rally3Off + 0x280;
                rallyPoints[33] = mio.ReadString(0x3E, Encoding.Unicode);
            }
            #endregion


            if (rallyPoints[24] != null) { rallyPoints[0] = "3"; }
            else if (rallyPoints[13] != null) { rallyPoints[0] = "2"; }
            else if (rallyPoints[2] != null) { rallyPoints[0] = "1"; }
            else { rallyPoints[0] = "0"; }

            rallyPoints[34] = rally2Off.ToString();
            rallyPoints[35] = rally3Off.ToString();

            return rallyPoints;
        }
    }

    static class saveMapInfoData
    {
        private static string gameEngineNamesHeString = "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
        private static string gameEngineMapName = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
        private static string gameEngineMapDesc = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
        private static string gameEngineRallyPointEngineCall = "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";
        private static string gameEngineRallyPointName = "0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000";

        /// <summary>
        /// Save the Engines internal map name
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="internalEngineMapName">Input string containing the Engines internal map name</param>
        public static void saveInternalEngineMapName(MojosIO mio, string internalEngineMapName)
        {
            mio.Position = 0xF44;
            mio.WriteHexString(gameEngineNamesHeString);
            mio.Position = 0xF44;
            mio.WriteString(internalEngineMapName, Encoding.ASCII);
        }

        /// <summary>
        /// Saves the External, Physical Map Asset Name
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="physicalAssetMapName">Input string containing the External, Physical Map Asset Name</param>
        public static void savePhysicalAssetMapName(MojosIO mio, string physicalAssetMapName)
        {
            mio.Position = 0x1044;
            mio.WriteHexString(gameEngineNamesHeString);
            mio.Position = 0x1044;
            mio.WriteString(physicalAssetMapName, Encoding.ASCII);
        }

        /// <summary>
        /// Saves all Language Map Names
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="mapNames">Input string array of all map names in all 10 languages</param>
        public static void saveUniLanMapName(MojosIO mio, string[] mapNames)
        {
            //Get English (UK) map name
            mio.Position = 0x45;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x45;
            mio.WriteString(mapNames[0], Encoding.Unicode);

            //Get Japanese map name
            mio.Position = 0x85;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x85;
            mio.WriteString(mapNames[1], Encoding.Unicode);

            //Get German map name
            mio.Position = 0xC5;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0xC5;
            mio.WriteString(mapNames[2], Encoding.Unicode);

            //Get French map name
            mio.Position = 0x105;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x105;
            mio.WriteString(mapNames[3], Encoding.Unicode);

            //Get Spanish map name
            mio.Position = 0x145;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x145;
            mio.WriteString(mapNames[4], Encoding.Unicode);

            //Get Latin American Spanish map name
            mio.Position = 0x185;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x185;
            mio.WriteString(mapNames[5], Encoding.Unicode);

            //Get Italian map name
            mio.Position = 0x1C5;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x1C5;
            mio.WriteString(mapNames[6], Encoding.Unicode);

            //Get Korean map name
            mio.Position = 0x205;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x205;
            mio.WriteString(mapNames[7], Encoding.Unicode);

            //Get Chinese map name
            mio.Position = 0x245;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x245;
            mio.WriteString(mapNames[8], Encoding.Unicode);

            //Get Portuguese map name
            mio.Position = 0x2C5;
            mio.WriteHexString(gameEngineMapName);
            mio.Position = 0x2C5;
            mio.WriteString(mapNames[9], Encoding.Unicode);
        }

        /// <summary>
        /// Saves all Language Map Descriptions
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="mapDesc">Input string array of all map descriptions in all 10 languages</param>
        public static void saveUniLanMapDesc(MojosIO mio, string[] mapDesc)
        {
            //Get English (UK) map desc
            mio.Position = 0x345;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0x345;
            mio.WriteString(mapDesc[0], Encoding.Unicode);

            //Get Japanese map desc
            mio.Position = 0x445;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0x445;
            mio.WriteString(mapDesc[1], Encoding.Unicode);

            //Get German map desc
            mio.Position = 0x545;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0x545;
            mio.WriteString(mapDesc[2], Encoding.Unicode);

            //Get French map desc
            mio.Position = 0x645;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0x645;
            mio.WriteString(mapDesc[3], Encoding.Unicode);

            //Get Spanish map desc
            mio.Position = 0x745;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0x745;
            mio.WriteString(mapDesc[4], Encoding.Unicode);

            //Get Latin American Spanish map desc
            mio.Position = 0x845;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0x845;
            mio.WriteString(mapDesc[5], Encoding.Unicode);

            //Get Italian map desc
            mio.Position = 0x945;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0x945;
            mio.WriteString(mapDesc[6], Encoding.Unicode);

            //Get Korean map desc
            mio.Position = 0xA45;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0xA45;
            mio.WriteString(mapDesc[7], Encoding.Unicode);

            //Get Chinese map desc
            mio.Position = 0xB45;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0xB45;
            mio.WriteString(mapDesc[8], Encoding.Unicode);

            //Get Portuguese map desc
            mio.Position = 0xD45;
            mio.WriteHexString(gameEngineMapDesc);
            mio.Position = 0xD45;
            mio.WriteString(mapDesc[9], Encoding.Unicode);
        }

        /// <summary>
        /// Saves Rally Point 1 Names in every Language and Engine Calls
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="rallyPoints">Rally Point Array (# of RP, RP1, RP2, RP3, RP2 Offset, RP3 Offset)</param>
        public static void saveUniRallyPoint1(MojosIO mio, string[] rallyPoints)
        {
            //Mission Start - Omega
            mio.Position = 0x125C;
            mio.WriteHexString(gameEngineRallyPointEngineCall);
            mio.Position = 0x125C;
            mio.WriteString(rallyPoints[1], Encoding.Unicode);

            ///English
            mio.Position = 0x12E1;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x12E1;
            mio.WriteString(rallyPoints[2], Encoding.Unicode);

            ///Japanese
            mio.Position = 0x1320;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x1320;
            mio.WriteString(rallyPoints[3], Encoding.Unicode);

            ///German
            mio.Position = 0x1361;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x1361;
            mio.WriteString(rallyPoints[4], Encoding.Unicode);

            ///French
            mio.Position = 0x13A1;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x13A1;
            mio.WriteString(rallyPoints[5], Encoding.Unicode);

            ///Spanish
            mio.Position = 0x13E1;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x13E1;
            mio.WriteString(rallyPoints[6], Encoding.Unicode);

            ///Latin American Spanish
            mio.Position = 0x1421;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x1421;
            mio.WriteString(rallyPoints[7], Encoding.Unicode);

            ///Italian
            mio.Position = 0x1461;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x1461;
            mio.WriteString(rallyPoints[8], Encoding.Unicode);

            ///Korean
            mio.Position = 0x14A0;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x14A0;
            mio.WriteString(rallyPoints[9], Encoding.Unicode);

            ///Chinese
            mio.Position = 0x14E0;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x14E0;
            mio.WriteString(rallyPoints[10], Encoding.Unicode);

            ///Portuguese
            mio.Position = 0x1561;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = 0x1561;
            mio.WriteString(rallyPoints[11], Encoding.Unicode);
        }

        /// <summary>
        /// Saves Rally Point 2 Names in every Language and Engine Calls
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="rallyPoints">Rally Point Array (# of RP, RP1, RP2, RP3, RP2 Offset, RP3 Offset)</param>
        public static void saveUniRallyPoint2(MojosIO mio, string[] rallyPoints)
        {
            //Rally Point Alpha
            mio.Position = (Convert.ToInt32(rallyPoints[34]) - 133);
            mio.WriteHexString(gameEngineRallyPointEngineCall);
            mio.Position = (Convert.ToInt32(rallyPoints[34]) - 133);
            mio.WriteString(rallyPoints[12], Encoding.Unicode);

            ///English
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[13], Encoding.Unicode);

            ///Japanese
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x3F;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[14], Encoding.Unicode);

            ///German
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x80;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[15], Encoding.Unicode);

            ///French
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0xC0;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[16], Encoding.Unicode);

            ///Spanish
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x100;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[17], Encoding.Unicode);

            ///Latin American Spanish
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x140;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[18], Encoding.Unicode);

            ///Italian
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x180;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[19], Encoding.Unicode);

            ///Korean
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x1BF;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[20], Encoding.Unicode);

            ///Chinese
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x1FF;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[21], Encoding.Unicode);

            ///Portuguese
            mio.Position = Convert.ToInt32(rallyPoints[34]) + 0x280;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[34]);
            mio.WriteString(rallyPoints[22], Encoding.Unicode);
        }

        /// <summary>
        /// Saves Rally Point 3 Names in every Language and Engine Calls
        /// </summary>
        /// <param name="mio">Mojos IO already declared</param>
        /// <param name="rallyPoints">Rally Point Array (# of RP, RP1, RP2, RP3, RP2 Offset, RP3 Offset)</param>
        public static void saveUniRallyPoint3(MojosIO mio, string[] rallyPoints)
        {
            //Rally Point Bravo
            mio.Position = (Convert.ToInt32(rallyPoints[35]) - 133);
            mio.WriteHexString(gameEngineRallyPointEngineCall);
            mio.Position = (Convert.ToInt32(rallyPoints[35]) - 133);
            mio.WriteString(rallyPoints[23], Encoding.Unicode);

            ///English
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[24], Encoding.Unicode);

            ///Japanese
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x3F;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[25], Encoding.Unicode);

            ///German
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x80;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[26], Encoding.Unicode);

            ///French
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0xC0;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[27], Encoding.Unicode);

            ///Spanish
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x100;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[28], Encoding.Unicode);

            ///Latin American Spanish
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x140;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[29], Encoding.Unicode);

            ///Italian
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x180;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[30], Encoding.Unicode);

            ///Korean
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x1BF;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[31], Encoding.Unicode);

            ///Chinese
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x1FF;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[32], Encoding.Unicode);

            ///Portuguese
            mio.Position = Convert.ToInt32(rallyPoints[35]) + 0x280;
            mio.WriteHexString(gameEngineRallyPointName);
            mio.Position = Convert.ToInt32(rallyPoints[35]);
            mio.WriteString(rallyPoints[33], Encoding.Unicode);
        }
    }
}